home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "HTTPSystem"
- '--------------------------------------------------------
- '<Purpose> provides support for a remote HTTP system
- '--------------------------------------------------------
-
- Option Explicit
-
-
- '------------------------------------------------------------
- '<Purpose> populates the TreeView with HTTP Servers that
- ' are designated to be "reconnected at logon"
- '------------------------------------------------------------
- Public Sub AddHTTPServers(ThisExplorer As Form, ParentNode As Node)
- Dim DriveImage As Integer
- Dim InstanceServer As HTTPServer
- Dim TheseNodes As Nodes
- Dim WorkingNode As Node
- Dim NodeKey As String
- Dim ParentKey As String
-
- ThisExplorer.MousePointer = vbHourglass
-
- '---- errors can be generated from duplicate keys; ignore
- On Error Resume Next
-
- '---- cache nodes collection
- Set TheseNodes = ThisExplorer.Tree.Nodes
-
- ParentKey = ParentNode.Key & "."
-
- For Each InstanceServer In MapServers.Servers
- NodeKey = ParentKey & InstanceServer.Alias
-
- If (Not IsKeyed(TheseNodes, NodeKey)) Then
- If (InstanceServer.Reconnect = vbChecked) Then
- '---- add the node to the tree
- Set WorkingNode = TheseNodes.Add(ParentNode, tvwChild, NodeKey, InstanceServer.Alias, imgHTTPDrive)
-
- '---- also create and add attachment
- Dim ThisAttachment As New Attachment
- Dim ThisSession As New Session
-
- ThisAttachment.NodeType = nodHTTPServer
- Set ThisSession.ThisServer = InstanceServer
- Set ThisAttachment.Session = ThisSession
- Call ThisExplorer.Attachments.Add(ThisAttachment, NodeKey)
-
- Set ThisSession = Nothing
- Set ThisAttachment = Nothing
-
- '---- add searching placeholder
- Call TheseNodes.Add(WorkingNode, tvwChild, WorkingNode.Key & nodPlaceHolder, nodPlaceHolder, imgPlaceHolder)
- End If
- End If
- Next
-
- Cleanup:
- On Error GoTo 0
-
- Set InstanceServer = Nothing
- Set TheseNodes = Nothing
- Set WorkingNode = Nothing
-
- ThisExplorer.MousePointer = vbDefault
- End Sub
-
- '--------------------------------------------------------
- '<Purpose> starts the process of getting HTTP directories
- '--------------------------------------------------------
- Public Function ListHTTPServer(ThisExplorer As Form, ServerNode As Node) As Boolean
- Dim ThisSession As Form
- Dim ThisAttachment As Attachment
-
- On Error GoTo BadSession
- Set ThisAttachment = ThisExplorer.Attachments.Item(ServerNode.Key)
- Set ThisSession = ThisAttachment.Session
-
- '---- create the session and set the callback
- With ThisSession
- .WorkingDir = ThisAttachment.DrivePath
- Call .InitSession
- Set .ServerNode = ServerNode
- Set .ThisExplorer = ThisExplorer
- Set .ThisCallback = New HTTPCallback
- Call .Connect
- End With
-
- ListHTTPServer = True
-
- Cleanup:
- On Error GoTo 0
- Set ThisSession = Nothing
- Set ThisAttachment = Nothing
- Exit Function
-
- BadSession:
- ListHTTPServer = False
- GoTo Cleanup
- End Function
-
- '--------------------------------------------------------
- '<Purpose> maps an HTTPServer to the Explorer
- '--------------------------------------------------------
- Public Function MapServer(ThisExplorer As Form) As Boolean
- Dim ParentNode As Node
- Dim ServerNode As Node
- Dim TheseNodes As Nodes
- Dim ThisSession As New Session
- Dim ServerKey As String
-
- With MapServers
- Set .ThisExplorer = ThisExplorer
- .Show vbModal
- If (Not .PressedOK) Then GoTo Cleanup
- End With
-
- '---- cache nodes collection
- Set TheseNodes = ThisExplorer.Tree.Nodes
-
- Set ThisSession.ThisServer = MapServers.ThisServer
-
- '---- add the node to the tree
- Set ParentNode = TheseNodes.Item("Root.HTTPServers")
- ServerKey = ParentNode.Key & "." & ThisSession.ThisServer.Alias
-
- '---- may already be in TreeView, if not add it
- If (Not IsKeyed(TheseNodes, ServerKey)) Then
- Set ServerNode = TheseNodes.Add(ParentNode, tvwChild, ServerKey, ThisSession.ThisServer.Alias, imgHTTPDrive)
-
- '---- add searching placeholder
- Call TheseNodes.Add(ServerNode, tvwChild, ServerNode.Key & nodPlaceHolder, nodPlaceHolder, imgPlaceHolder)
-
- '---- also create and add attachment
- Dim ThisAttachment As New Attachment
- ThisAttachment.NodeType = nodHTTPServer
- Set ThisAttachment.Session = ThisSession
- Call ThisExplorer.Attachments.Add(ThisAttachment, ServerKey)
- Set ThisAttachment = Nothing
-
- End If
-
- Cleanup:
- Set ParentNode = Nothing
- Set TheseNodes = Nothing
- Set ThisSession = Nothing
- Set ServerNode = Nothing
-
- End Function
-
-
-